<?php

/**
 * @package    sfDoctrineCronManagerPlugin
 * @author     Bob Stremel <bob.stremel@gmail.com>
 */
class CronManagerDoctrine extends CronManager
{
  public function loadJobs()
  {
    $this->jobs = Doctrine::getTable('sfCronManagerJob')->findAll();
  }

  public function updateRunData($job)
  {
    $job->setLastRan(date('Y-m-d H:i:s'));
    $job->save();
  }

  public function runProcessOnce($cron_id)
  {
    $record = Doctrine::getTable('sfCronManagerJob')->find($cron_id);
    $this->runProcess($record);
  }

  public function saveJob()
  {
    $record = new CronManagerJob();
    $record->merge($this->job_record);
    $record->save();
  }

}